﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace Excel16AddIn_Z01
{
    public class WinApiUtil
    {
        [DllImport("user32.dll")]
        public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndlnsertAfter, int X, int Y, int cx, int cy, uint Flags);

        //hWndInsertAfter 参数可选值:
        public const uint HWND_TOP = 0;// 在前面
        public const uint HWND_BOTTOM = 1;// 在后面

        public const int HWND_TOPMOST = -1;// {在前面, 位于任何顶部窗口的前面}
        public const int HWND_NOTOPMOST = -2;// {在前面, 位于其他顶部窗口的后面}

        //uFlags 参数可选值:
        public const uint SWP_NOSIZE = 1;// {忽略 cx、cy, 保持大小}
        public const uint SWP_NOMOVE = 2;// {忽略 X、Y, 不改变位置}
        public const uint SWP_NOZORDER = 4;// {忽略 hWndInsertAfter, 保持 Z 顺序}
        public const uint SWP_NOREDRAW = 8;// {不重绘}
        public const uint SWP_NOACTIVATE = 0x10;// {不激活}
        public const uint SWP_FRAMECHANGED = 0x20;// {强制发送 WM_NCCALCSIZE 消息, 一般只是在改变大小时才发送此消息}
        public const uint SWP_SHOWWINDOW = 0x40;// {显示窗口}
        public const uint SWP_HIDEWINDOW = 0x80;// {隐藏窗口}
        public const uint SWP_NOCOPYBITS = 0x100;// {丢弃客户区}
        public const uint SWP_NOOWNERZORDER = 0x200;// {忽略 hWndInsertAfter, 不改变 Z 序列的所有者}
        public const uint SWP_NOSENDCHANGING = 0x400;// {不发出 WM_WINDOWPOSCHANGING 消息}
        public const uint SWP_DRAWFRAME = SWP_FRAMECHANGED;// {画边框}
        public const uint SWP_NOREPOSITION = SWP_NOOWNERZORDER;// {}
        public const uint SWP_DEFERERASE = 0x2000;// {防止产生 WM_SYNCPAINT 消息}
        public const uint SWP_ASYNCWINDOWPOS = 0x4000;// {若调用进程不拥有窗口, 系统会向拥有窗口的线程发出需求}

    }
}
